package com.bby.admin.controller;

import com.bby.admin.bean.AdminUser;
import com.bby.admin.service.AdminUserService;
import com.bby.common.utils.BBYUtils;
import com.bby.common.utils.R;
import com.bby.common.utils.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

@RestController
@RequestMapping("admin/user")
public class UserController {

    @Autowired
    private AdminUserService userService;

    @PostMapping("login")
    R login(@RequestBody AdminUser user){
        if (BBYUtils.hasEmpty(user.getUsername(),user.getPassword())){
            return R.error(StatusCode.PASS_ERROR,"用户名或密码错误");
        }
        userService.login(user);

        return R.ok();
    }
}
